/*
 * This file is generated by jOOQ.
 */
package ru.ra_tech.garden_manager.database.schema.tables;


import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function3;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row3;
import org.jooq.Schema;
import org.jooq.SelectField;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import ru.ra_tech.garden_manager.database.schema.Keys;
import ru.ra_tech.garden_manager.database.schema.Public;
import ru.ra_tech.garden_manager.database.schema.tables.records.UserRolesRecord;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class UserRoles extends TableImpl<UserRolesRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>public.user_roles</code>
     */
    public static final UserRoles USER_ROLES = new UserRoles();

    /**
     * The class holding records for this type
     */
    @Override
    public Class<UserRolesRecord> getRecordType() {
        return UserRolesRecord.class;
    }

    /**
     * The column <code>public.user_roles.id</code>.
     */
    public final TableField<UserRolesRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");

    /**
     * The column <code>public.user_roles.name</code>.
     */
    public final TableField<UserRolesRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>public.user_roles.description</code>.
     */
    public final TableField<UserRolesRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.CLOB, this, "");

    private UserRoles(Name alias, Table<UserRolesRecord> aliased) {
        this(alias, aliased, null);
    }

    private UserRoles(Name alias, Table<UserRolesRecord> aliased, Field<?>[] parameters) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
    }

    /**
     * Create an aliased <code>public.user_roles</code> table reference
     */
    public UserRoles(String alias) {
        this(DSL.name(alias), USER_ROLES);
    }

    /**
     * Create an aliased <code>public.user_roles</code> table reference
     */
    public UserRoles(Name alias) {
        this(alias, USER_ROLES);
    }

    /**
     * Create a <code>public.user_roles</code> table reference
     */
    public UserRoles() {
        this(DSL.name("user_roles"), null);
    }

    public <O extends Record> UserRoles(Table<O> child, ForeignKey<O, UserRolesRecord> key) {
        super(child, key, USER_ROLES);
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : Public.PUBLIC;
    }

    @Override
    public Identity<UserRolesRecord, Integer> getIdentity() {
        return (Identity<UserRolesRecord, Integer>) super.getIdentity();
    }

    @Override
    public UniqueKey<UserRolesRecord> getPrimaryKey() {
        return Keys.USER_ROLES_PKEY;
    }

    @Override
    public List<UniqueKey<UserRolesRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.USER_ROLES_NAME_KEY);
    }

    @Override
    public UserRoles as(String alias) {
        return new UserRoles(DSL.name(alias), this);
    }

    @Override
    public UserRoles as(Name alias) {
        return new UserRoles(alias, this);
    }

    @Override
    public UserRoles as(Table<?> alias) {
        return new UserRoles(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public UserRoles rename(String name) {
        return new UserRoles(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public UserRoles rename(Name name) {
        return new UserRoles(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public UserRoles rename(Table<?> name) {
        return new UserRoles(name.getQualifiedName(), null);
    }

    // -------------------------------------------------------------------------
    // Row3 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row3<Integer, String, String> fieldsRow() {
        return (Row3) super.fieldsRow();
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function3<? super Integer, ? super String, ? super String, ? extends U> from) {
        return convertFrom(Records.mapping(from));
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    public <U> SelectField<U> mapping(Class<U> toType, Function3<? super Integer, ? super String, ? super String, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}
